<div id="invoices_list">


<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" id="table-stadistic">
  <thead>
    <tr>
      <th>Invoice</th>
      <th width="150">Month</th>
      <th>Inv Amt</th>
      <th width="86">Smtm Date</th>
      <th width="86">Due Date</th>
      <th width="85">Pd Date</th>
      <th>Amt Pd</th>
      <th>Details</th>
      <th>Pay Now</th>

    </tr>
  </thead>
  <tbody>
    <?php foreach ($invoices as $invoice): ?>
      <tr>
      <td><?php echo $invoice->getInvoiceGroup() ?></td>
      <td><?php echo date('F',strtotime($invoice->getInvoiceDatestart())); ?></td>
      <td><?php echo $invoice->getInvoiceNewprice() ?></td>
      <td><?php echo date('Y-m-d',strtotime($invoice->getInvoiceDatestart())); ?></td>
      <td><?php echo $invoice->getInvoiceDateend() ?></td>
      <td><?php if ($invoice->getInvoicePaid()=="no") : 
                    echo 'n/a';
                else : 
                    echo $invoice->getInvoicePaidDate();
                endif; ?>
      </td>
      <td><?php echo $invoice->getAmtPaid(); ?></td>
      <td><a href="<?php echo url_for('invoice/show?invoice_id='.$invoice->getInvoiceId()) ?>">Details</a></td>
      <td><?php if ($invoice->getInvoicePaid()=="no") : ?>
          <a onclick="payNow()" style="cursor:pointer">Pay Now</a>
          <?php else : ?>
                    Payed;
          <?php endif; ?>
      </td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>


<div class="pagination">
  <?php if ($pager->haveToPaginate()): ?>

    <?php if (!$pager->isFirstPage()) :  ?>
      <a onclick="paginateInvoices(1)" style="cursor:pointer"><?php echo 'First' ?></a>

      <span class="imag"><img src="/images/anterior_ico.gif" width="7" height="8" alt="" /></span>
      <a onclick="paginateInvoices(<?php echo $pager->getPreviousPage() ?>)" style="cursor:pointer"><?php echo 'Previous' ?></a>
    <?php endif; ?>

    <?php foreach ($pager->getLinks() as $page): ?>
      <?php if ($page == $pager->getPage()): ?>
        <?php echo $page ?>
      <?php else: ?>
      <a onclick="paginateInvoices(<?php echo $page ?>)" style="cursor:pointer"><?php echo $page ?></a>
      <?php endif; ?>
    <?php endforeach; ?>

    <?php if (!$pager->isLastPage()) :  ?>
      <a onclick="paginateInvoices(<?php echo $pager->getNextPage() ?>)" style="cursor:pointer"> <?php echo 'Next' ?></a>  <span class="imag"><img src="/images/siguiente_ico.gif" width="7" height="8" alt="" /></span>

      <a onclick="paginateInvoices(<?php echo $pager->getLastPage() ?>)" style="cursor:pointer"><?php echo 'Last' ?></a>
    <?php endif; ?>

  <?php endif; ?>

</div>
    
</div>